class Car:
    # init函数属于python的魔法函数，魔法函数会自动调用，调用时机不一样 当我们创建这个类的对象的时候
    def __init__(self):
        print("init函数被调用了")
        self.__speed = 10
        self.__capacity = 0

    def add_speed(self,speed):
        print(f"加速到了{speed}")

    def diff_speed(self,speed):
        print(f"减速到了{speed}")

    def add_people(self,num):
        print(f"目前的容量为{num}")

    def get_speed(self):
        return self.__speed

    def set_speed(self,speed):
        if speed < 0:
            self.__speed = 0
        else:
            self.__speed = speed

car = Car()

